import 'package:equatable/equatable.dart';
import 'package:learning_content_admin_pannel.core/core/domain/entities/page_models/app_navigator_page_model.dart';
import 'package:learning_content_admin_pannel.core/core/domain/utils/uuid_generator.dart';

part 'fragment_models/collection_list_item_fragment_model.dart';

part 'fragment_models/home_page_fragment_model.dart';

part 'fragment_models/phrasal_verb_fragment_model.dart';

part 'fragment_models/word_fragment_model.dart';

class HomePageModel extends Equatable implements AppNavigatorPageModel {
  HomePageModel({
    String? id,
    required this.fragmentModel,
  }) : id = id ?? UuidGenerator().generateUuid();

  @override
  final String id;

  final HomePageFragmentModel fragmentModel;

  @override
  bool get permittedWithAuthorization => true;

  @override
  bool get permittedWithoutAuthorization => false;

  @override
  List<Object?> get props {
    return [
      id,
      fragmentModel,
    ];
  }

  @override
  HomePageModel copyWith({
    String Function()? id,
    HomePageFragmentModel Function()? fragmentModel,
  }) {
    return HomePageModel(
      id: id == null ? this.id : id(),
      fragmentModel: fragmentModel == null ? this.fragmentModel : fragmentModel(),
    );
  }
}
